﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSem3.Admin
{
    public partial class WebForm23 : System.Web.UI.Page
    {
        private DataClassesHeaxlthDataContext dc = new DataClassesHeaxlthDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                join();
            }
        }
        public void join()
        {
            var request = this.dc.PolicyRequestDetails.Join(dc.EmpRegisters, r => r.empno, p => p.empno, (r, p) => new
            {
                r.requestid,
                r.requestdate,
                r.empno,
                r.policyid,
                r.companyid,
                r.status,
                p.username
            }).Join(dc.policies, r => r.policyid, p => p.policyid, (r, p) => new
            {
                r.requestid,
                r.requestdate,
                r.empno,
                r.policyid,
                r.companyid,
                r.username,
                p.policyname,
                r.status,
                p.amount,
                p.emi
            }).Join(dc.CompanyDetails, r => r.companyid, c => c.companyid, (r, c) => new {
                r.requestid,
                r.requestdate,
                r.empno,
                r.policyid,
                r.companyid,
                r.username,
                r.policyname,
                r.status,
                r.amount,
                r.emi,
                c.companyname
            }).Where(a => a.status.Equals("no")).OrderByDescending(o => o.requestid);
            this.Repeater1.DataSource = request.ToList();
            this.Repeater1.DataBind();
        }
    }
}